package com.boang.bank;

import com.boang.entity.Animal;
import com.boang.entity.Cat;
import com.boang.entity.Dog;

/*
  @author: 13813
  @date: 2024/11/19 11:43
*/
public class Dt {
    public static void main(String[] args) {
//        Dog dog = new Dog();
//        dog.eat();
//        dog.kanJia();

        //父类型指向子类对象
        Animal dog = new Dog();//多态
        dog.eat();
        m1(dog);
        //向上转型，特有方法就不能调用了
//        dog.kanJia();

//        Dog dogg = (Dog)dog;
//        dogg.kanJia();

//        Cat cat = new Cat();
//        cat.eat();
//        cat.zhuaShu();
        //多态
        Animal cat = new Cat();
        cat.eat();
        m1(cat);
//        cat.zhuaShu();

//        m1(dog);
    }

    //多态，解耦
    public static void m1(Animal dog) {

    }
}
